<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
	<head>
		<title>test dojo</title>
		<style type="text/css">
				@import url("http://leoner.tianji.com/dojo/resources/dojo.css");
				@import url("http://leoner.tianji.com/dojo/resources/dnd.css");
				@import url("http://www.sitepen.com/labs/code/dnd/intro/dnd/site-1.css");
				#catalogNode,#cart,#wishlist {
					float:left;
					width:100px;
					height:300px;
					border:1px solid red
				}
		</style>
		<script type="text/javascript" src="http://leoner.tianji.com/dojo/dojo.js" djConfig="parseOnLoad: true"></script>
		<script type="text/javascript">
			//<![CDATA[
			dojo.require("dojo.dnd.Source");
			source = dojo.dnd.Source;
			dojo.addOnLoad(function(){
				createCatalog();
			});
			dojo.dnd.manager().canDrop(false);
			var catalog;
			function createCatalog(){
				catalog = new source("catalogNode",{accept: ["inStock","outOfStock"]});
				catalog.checkAcceptance = checkAcceptanceWithoutSelfDrop;
				catalog.insertNodes(false,[
					{ data: "Wrist watch",        type: ["inStock"] },
					{ data: "Life jacket",        type: ["inStock"] },
					{ data: "Toy bulldozer",      type: ["inStock"] },
					{ data: "Vintage microphone", type: ["outOfStock"] },
					{ data: "TIE fighter",        type: ["outOfStock"] },
					{ data: "Apples",             type: ["inStock"] },
					{ data: "Bananas",            type: ["inStock"] },
					{ data: "Tomatoes",           type: ["outOfStock"] },
					{ data: "Bread",              type: ["inStock"] }
				]);
				var cart = new source("cart", {
					accept: ["inStock","outOfStock"]
				});
				var wishlist = new source("wishlist", {
					accept: ["inStock","outOfStock"]
				});
			}
			function checkAcceptanceWithoutSelfDrop(source,nodes) {
				console.log(source);
				console.log(this);
				if(this == source){
					//return false;
				}
				for(var i = 0; i < nodes.length; i++){
					var type = source.getItem(nodes[i].id).type;
					var falg = false;
					for(var j = 0; j < type.length;++j){
						if(type[j] in this.accept){
							flag = true;
							break;
						}
					}
					if(!flag){
						return false;
					}
				}
				return true;
			} // End of checkAcceptanceWithoutSelfDrop
			
			//]]>
		</script>
	</head>
	<body>
	<div id="store">
		<div class="wishlistContainer">
			<h2>Wishlist</h2>
			<ol id="wishlistNode" class="container">
				<li class="nodeItem">Wrisssst watch</li>
				<li class="nodeItem">Life jacket</li>
				<li class="nodeItem">Toy bulldozer</li>
				<li class="nodeItem">Vintage microphone</li>
				<li class="nodeItem">TIE fighter</li>
			</ol>
		</div>
		<h2>catalogNode</h2>
		<div id="catalogNode">


		</div>
		<h2>cart</h2>
		<div id="cart">
			

		</div>
		<h2>wishlist</h2>
		<div id="wishlist">


		</div>
		
	</div>
	
	</body>
</html>